package com.example.demo.mapper;

import com.example.demo.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 部门管理
 */
@Mapper // Spring 容器 识别 Mapper注解 放到容器中。
public interface DeptMapper {

    @Select("select * from dept;")
    List<Dept> selectAllDepts();

    @Delete("delete from dept where id=#{id};")
    int deleteDeptById(int id);

    @Insert("insert into dept (name, create_time, update_time) values (#{name},#{createTime},#{updateTime});")
    int insertDept(Dept dept);

    @Select("select * from dept where id=#{id};")
    Dept findDeptById(int id);

    @Update("update dept set name = #{name},update_time=#{updateTime} where id=#{id};")
    int updateDept(Dept dept);
}
